In this demonstration, you use a supervised machine learning algorithm to train a neural network a model. Using a pre-created flow, you also partition the data to perform honest assessment. Finally, you tune the hyperparameter values to improve the performance of the model.
Reminder: If you restarted your SAS session, or it has timed out due to inactivity, you must re-create the course libraries, LOCALLIB and VST. To do this, run the AssignLibrary flow.
proc nnet data=VST.PVA_DONORS_FINAL standardize=std; partition fraction (validate=0.5 seed=12345); target Response / level=nominal; input GiftAvg36 PromCntAll PromCnt36 / level=interval; input StatusCat96NK DemGender DemHomeOwner / level=nominal; hidden 50; train stagnation=5 outmodel=VST.Nnet_model; optimization regL2=0.1; *train stagnation=5 outmodel=VST.Nnet_model2; *optimization regL2=0.001; run;
In a practical scenario, you should consider all 12 features selected in the previous demo performing variable selection, but for the purposes of brevity, here we will be using only the top 6 features (inputs).
The Model Information table includes information about the number of observations used to train the model, the number of hidden layers, hidden nodes, and the number of parameters estimated.
Note that the misclassification rate for validation data is 0.4511. Because the target variable is nominal, the algorithm tries to choose parameter estimates that can optimize the estimation criterion, which is the misclassification rate in this case.
The Iteration History table indicates that the algorithm performed 9 iterations in all, with the final model having the smallest validate error value (0.4511).
Note: Some SAS Visual Data Mining and Machine Learning models (including the neural network) are created using a nondeterministic process. This means that you might experience different results when you rerun the task.
To improve the performance of the model, you might want to add more inputs or tune the hyperparameter values, or both.
Next you will edit some of the hyperparameters.
proc nnet data=VST.PVA_DONORS_FINAL standardize=std; partition fraction (validate=0.5 seed=12345); target Response / level=nominal; input GiftAvg36 PromCntAll PromCnt36 / level=interval; input StatusCat96NK DemGender DemHomeOwner / level=nominal; hidden 50; *train stagnation=5 outmodel=Nnet_model; *optimization regL2=0.1; train stagnation=5 outmodel=VST.Nnet_model2; optimization regL2=0.001; run;
The Model information table indicates that the chosen model is the one with a misclassification rate on validation data equal to 0.4317, which is slightly lower than that of the previous model.
The Iteration History table indicates that the algorithm has performed as many as 103 iterations in the search for an optimal solution. However, the optimal solution was obtained at iteration number 53, producing the smallest misclassification rate on the validation data.
Note that the result produced by the neural network is not as interpretable as the regression models you saw earlier. This is often cited as one of the limitations of machine learning models, a topic that is discussed in the next section.